Skip to content

Fix: left right duplication#70

Merged
mgriebling merged 3 commits into
mgriebling:mainfrom
samuelzxu:fix/issue-66-left-right-duplication
Jun 29, 2026
Merged

Fix: left right duplication#70
mgriebling merged 3 commits into
mgriebling:mainfrom
samuelzxu:fix/issue-66-left-right-duplication

Conversation

@samuelzxu

@samuelzxu samuelzxu commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

The inner content of \left( and \right) should be typeset at most once to avoid duplication errors.

Thanks for maintaining this tool! I use it in my repo and found this issue with it which was already open.

Fixes #66

)

makeLeftRight typeset the inner math list twice — once to size the
delimiters and once to place the content. Typesetting an MTMathList is
not idempotent: preprocessMathList fuses adjacent ordinary atoms in
place via MTMathAtom.fuse (nucleus += atom.nucleus), so the second pass
re-fused already-fused runs and duplicated any multi-atom content inside
a \left…\right group. Nesting compounded the effect (one extra pass per
level).

Typeset the inner list once, cache the resulting MTMathListDisplay, and
reuse it for both the delimiter-height calculation and placement.

Adds LeftRightDuplicationTests covering the issue mgriebling#66 reporter
expression plus fraction, bracket, nested, and \left. variants.
@samuelzxu

Copy link
Copy Markdown
Contributor Author

@mgriebling ping on this - thoughts?

@mgriebling mgriebling merged commit 1d2c908 into mgriebling:main Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate characters are rendered when \left and \right are used

2 participants